home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / ksslsettings.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  5.0 KB  |  225 lines

  1. /* This file is part of the KDE project
  2.  *
  3.  * Copyright (C) 2000-2003 George Staikos <staikos@kde.org>
  4.  *
  5.  * This library is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU Library General Public
  7.  * License as published by the Free Software Foundation; either
  8.  * version 2 of the License, or (at your option) any later version.
  9.  *
  10.  * This library is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * Library General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU Library General Public License
  16.  * along with this library; see the file COPYING.LIB.  If not, write to
  17.  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.  * Boston, MA 02110-1301, USA.
  19.  */
  20.  
  21. #ifndef _KSSLSETTINGS_H
  22. #define _KSSLSETTINGS_H
  23.  
  24. #include <qstring.h>
  25. #include <qvaluelist.h>
  26. #include <kconfig.h>
  27.  
  28. class KSSLSettingsPrivate;
  29.  
  30. /**
  31.  * KDE SSL Settings
  32.  *
  33.  * This class contains some of the SSL settings for easy use.
  34.  *
  35.  * @author George Staikos <staikos@kde.org>
  36.  * @see KSSL
  37.  * @short KDE SSL Settings
  38.  */
  39. class KIO_EXPORT KSSLSettings {
  40. public:
  41.     /**
  42.      *  Construct a KSSL Settings object
  43.      *
  44.      *  @param readConfig read in the configuration immediately if true
  45.      */
  46.     KSSLSettings(bool readConfig = true);
  47.  
  48.     /**
  49.      *  Destroy this KSSL Settings object
  50.      */
  51.     ~KSSLSettings();
  52.  
  53.     /**
  54.      *  Does the user allow SSLv2
  55.      *  @return true if the user allows SSLv2
  56.      */
  57.     bool sslv2() const;
  58.  
  59.     /**
  60.      *  Does the user allow SSLv3
  61.      *  @return true if the user allows SSLv3
  62.      */
  63.     bool sslv3() const;
  64.  
  65.     /**
  66.      *  Does the user allow TLSv1
  67.      *  @return true if the user allows TLSv1
  68.      */
  69.     bool tlsv1() const;
  70.  
  71.     /**
  72.      *  Does the user want to be warned on entering SSL mode
  73.      *  @return true if the user wants to be warned
  74.      */
  75.     bool warnOnEnter() const;
  76.  
  77.     /**
  78.      *  Change the user's warnOnEnter() setting
  79.      *  @since 3.3
  80.      *  @param x true if the user is to be warned
  81.      *  @see warnOnEnter
  82.      */
  83.     void setWarnOnEnter(bool x);
  84.     
  85.     /**
  86.      *  Does the user want to be warned on sending unencrypted data
  87.      *  @return true if the user wants to be warned
  88.      *  @see setWarnOnUnencrypted
  89.      */
  90.     bool warnOnUnencrypted() const;
  91.  
  92.     /**
  93.      *  Change the user's warnOnUnencrypted() setting
  94.      *  @param x true if the user is to be warned
  95.      *  @see warnOnUnencrypted
  96.      */
  97.     void setWarnOnUnencrypted(bool x);
  98.  
  99.     /**
  100.      *  Does the user want to be warned on leaving SSL mode
  101.      *  @return true if the user wants to be warned
  102.      */
  103.     bool warnOnLeave() const;
  104.  
  105.     /**
  106.      *  Change the user's warnOnLeave() setting
  107.      *  @since 3.3
  108.      *  @param x true if the user is to be warned
  109.      *  @see warnOnLeave
  110.      */
  111.     void setWarnOnLeave(bool x);
  112.     
  113.     /**
  114.      *  Does the user want to be warned during mixed SSL/non-SSL mode
  115.      *  @return true if the user wants to be warned
  116.      */
  117.     bool warnOnMixed() const;
  118.  
  119.     /**
  120.      *  Do not use this
  121.      *  @deprecated
  122.      */
  123.     bool warnOnSelfSigned() const KDE_DEPRECATED;
  124.  
  125.     /**
  126.      *  Do not use this
  127.      *  @deprecated
  128.      */
  129.     bool warnOnRevoked() const KDE_DEPRECATED;
  130.  
  131.     /**
  132.      *  Do not use this
  133.      *  @deprecated
  134.      */
  135.     bool warnOnExpired() const KDE_DEPRECATED;
  136.  
  137.     /**
  138.      *  Does the user want to use the Entropy Gathering Daemon?
  139.      *  @return true if the user wants to use EGD
  140.      */
  141.     bool useEGD() const;
  142.  
  143.     /**
  144.      *  Does the user want to use an entropy file?
  145.      *  @return true if the user wants to use an entropy file
  146.      */
  147.     bool useEFile() const;
  148.   
  149.     /**
  150.      *  Change the user's TLSv1 preference
  151.      *  @param enabled true if TLSv1 is enabled
  152.      */
  153.     void setTLSv1(bool enabled);
  154.   
  155.     /**
  156.      *  Change the user's SSLv2 preference
  157.      *  @param enabled true if SSLv2 is enabled
  158.      */
  159.     void setSSLv2(bool enabled);
  160.   
  161.     /**
  162.      *  Change the user's SSLv3 preference
  163.      *  @param enabled true if SSLv3 is enabled
  164.      */
  165.     void setSSLv3(bool enabled);
  166.  
  167.     /**
  168.      *  Does the user want X.509 client certificates to always be sent when
  169.      *  possible?
  170.      *  @return true if the user always wants a certificate sent
  171.      */
  172.     bool autoSendX509() const;
  173.  
  174.     /**
  175.      *  Does the user want to be prompted to send X.509 client certificates
  176.      *  when possible?
  177.      *  @return true if the user wants to be prompted
  178.      */
  179.     bool promptSendX509() const;
  180.  
  181.     /**
  182.      *  Get the OpenSSL cipher list for selecting the list of ciphers to
  183.      *  use in a connection.
  184.      *  @return the cipher list
  185.      */
  186.     QString getCipherList();
  187.  
  188.     /**
  189.      *  Get the configured path to the entropy gathering daemon or entropy
  190.      *  file.
  191.      *  @return the path
  192.      */
  193.     QString& getEGDPath();
  194.  
  195.     /**
  196.      *  Load the user's settings.
  197.      */
  198.     void load();
  199.  
  200.     /**
  201.      *  Revert to default settings.
  202.      */
  203.     void defaults();
  204.  
  205.     /**
  206.      *  Save the current settings.
  207.      */
  208.     void save();
  209.  
  210. private:
  211.     KConfig *m_cfg;
  212.     bool m_bUseSSLv2, m_bUseSSLv3, m_bUseTLSv1;
  213.     bool m_bWarnOnEnter, m_bWarnOnUnencrypted, m_bWarnOnLeave, m_bWarnOnMixed;
  214.     bool m_bWarnSelfSigned, m_bWarnRevoked, m_bWarnExpired;
  215.  
  216.     QValueList<QString> v2ciphers, v2selectedciphers, v3ciphers, v3selectedciphers;
  217.     QValueList<int> v2bits, v3bits;
  218.  
  219.     KSSLSettingsPrivate *d;
  220. };
  221.  
  222.  
  223. #endif
  224.  
  225.